package com.gouzheng.service.impl;

import com.gouzheng.dao.studentDao;
import com.gouzheng.entity.Student;
import com.gouzheng.service.studentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("studentService")
public class studentServieImpl implements studentService {

    @Autowired
    private studentDao studentDao;
    @Override
    public List<Student> findStudent(Integer superior,Integer deleteFlag) {
        return studentDao.findStudent(superior,deleteFlag);
    }

    @Override
    public int getTotal() {
        return studentDao.getTotal();
    }

    @Override
    public List<Student> getList(int start, int count,String stuName,int deleteFlag) {
        return studentDao.getList(start,count,stuName,deleteFlag);
    }

//    @Override
//    public List<Student> getStuName(String stuName) {
//        return studentDao.getStuName(stuName);
//    }


    @Override
    public void addStudent(Student student) {
        String stuNum="Gz"+(int)((Math.random()*9+1)*1000);
        student.setStuNum(stuNum);
        studentDao.addStudent(student);
    }

    @Override
    public void updateStudent(Student student) {
        studentDao.updateStudent(student);
    }

    @Override
    public Student findStuId(Integer stuId) {
        return studentDao.findStuId(stuId);
    }

    @Override
    public void deleteStu(Integer stuId) {
        studentDao.deleteStu(stuId);
    }


}
